# eric7.ViewManager.NavigationHistory

Mdule implementing the viewmanager navigation history related classes.

### Global Attributes

None

### Classes

NavigationHistory | Class implementing the navigation history controller.
NavigationHistoryItem | Class defining the data structure of a navigation history entry.

### Functions

None

## NavigationHistory

Class implementing the navigation history controller.

### Signals

historyChanged()
  emitted to indicate a change of history
historyCleared()
  emitted to indicate that the history was cleared
historyItemAdded()
  emitted to indicate that a new entry was recorded

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

NavigationHistory | Constructor
__adjustHistorySize | Private method to adjust the size of the kept history.
addItem | Public method to add an item to the history and make it the current one.
back | Public slot to set the current item to be the previous one and move to that place.
backItem | Public method to get the item before the current item.
backItems | Public method to get the list of items in the backwards history list.
canGoBack | Public method to check, if backward movement is possible.
canGoForward | Public method to check, if forward movement is possible.
clear | Public method to clear the history.
count | Public method to get the total number of items in the history.
currentItem | Public method to get the current item.
forward | Public slot to set the current item to be the next one and move to that place.
forwardItem | Public method to get the item after the current item.
forwardItems | Public method to get the list of items in the forwards history list.
goToItem | Public method to set the current item to the specified item in the history and go to that location.
items | Public method to get the list of items currently in the history.
recordPosition | Public slot to record the given position.
setMaximumSize | Public method to set the maximum number of entries to be kept.
setMinimumLineOffset | Public method to set minimum line offset to record a new entry.

### Static Methods

None

#### NavigationHistory (Constructor)

NavigationHistory(vm, offset=5, maxEntries=100, parent=None)

Constructor

vm (ViewManager)
  reference to the viewmanager object
offset (int (optional))
  minimum line offset for recording (defaults to 10)
maxEntries (int (optional))
  maximum number of history entries (defaults to 100)
parent (QObject (optional))
  reference to the parent object (defaults to None)

#### NavigationHistory.__adjustHistorySize

__adjustHistorySize()

Private method to adjust the size of the kept history.

#### NavigationHistory.addItem

addItem(item)

Public method to add an item to the history and make it the current one.

This method clears the forward history list. If the given item is already the current item, the addition and clearing is skipped.

item (NavigationHistoryItem)
  item to be added

#### NavigationHistory.back

back()

Public slot to set the current item to be the previous one and move to that place.

#### NavigationHistory.backItem

backItem()

Public method to get the item before the current item.

Return:
  item before the current item

Return Type:
  NavigationHistoryItem

#### NavigationHistory.backItems

backItems()

Public method to get the list of items in the backwards history list.

Return:
  copy of backwards history items

Return Type:
  list of NavigationHistoryItem

#### NavigationHistory.canGoBack

canGoBack()

Public method to check, if backward movement is possible.

Return:
  flag indicating possible backward movement

Return Type:
  bool

#### NavigationHistory.canGoForward

canGoForward()

Public method to check, if forward movement is possible.

Return:
  flag indicating possible forward movement

Return Type:
  bool

#### NavigationHistory.clear

clear()

Public method to clear the history.

#### NavigationHistory.count

count()

Public method to get the total number of items in the history.

Return:
  total number of history items

Return Type:
  int

#### NavigationHistory.currentItem

currentItem()

Public method to get the current item.

Return:
  current item

Return Type:
  NavigationHistoryItem

#### NavigationHistory.forward

forward()

Public slot to set the current item to be the next one and move to that place.

#### NavigationHistory.forwardItem

forwardItem()

Public method to get the item after the current item.

Return:
  item after the current item

Return Type:
  NavigationHistoryItem

#### NavigationHistory.forwardItems

forwardItems()

Public method to get the list of items in the forwards history list.

Return:
  copy of forwards history items

Return Type:
  list of NavigationHistoryItem

#### NavigationHistory.goToItem

goToItem(item)

Public method to set the current item to the specified item in the history and go to that location.

item (NavigationHistoryItem)
  item to make the current one

#### NavigationHistory.items

items()

Public method to get the list of items currently in the history.

Return:
  list of all history items

Return Type:
  list of NavigationHistoryItem

#### NavigationHistory.recordPosition

recordPosition(filename, linenumber)

Public slot to record the given position.

This method records the given filename and line number with the history, if that is not already the current position. Recording a new position will clear the forward history list. Given positions will only be recorded, if the filename is different to the current one or the line number is different by a configurable offset (default 10).

filename (str)
  name of the file
linenumber (int)
  line number of the cursor

#### NavigationHistory.setMaximumSize

setMaximumSize(maxEntries)

Public method to set the maximum number of entries to be kept.

maxEntries (int)
  maximum number of entries

#### NavigationHistory.setMinimumLineOffset

setMinimumLineOffset(offset)

Public method to set minimum line offset to record a new entry.

offset (int)
  line offset value

Up

## NavigationHistoryItem

Class defining the data structure of a navigation history entry.

### Derived from

None

### Class Attributes

filename
linenumber

### Class Methods

None

### Methods

None

### Static Methods

None

Up